package com.linkwedo.saas.users;

import java.util.List;

import com.linkwedo.saas.domain.member.User;

public class UserService {
	
	
	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public User getUser(User user) {
		List<User> uList = getUserDao().findByProperty("email",user.getEmail());//getUserDao().findByExample(user);
		return uList.get(0);
	}
	
	public User getUserById(Integer userId) {
		User user= (User)getUserDao().findByProperty("id",userId).get(0);
		return user;
	}
	

	public List findAll() {		
		try {
			return getUserDao().findAll();
		} catch (RuntimeException re) {
			throw re;
		}
	}
	public void save(User transientInstance) {		
		try {
			getUserDao().save(transientInstance);		
		} catch (RuntimeException re) {			
			throw re;
		}
	}
}
